<?php
/**
 * 该示例主要为JPush Push API的调用示例
 * HTTP API文档:http://docs.jpush.io/server/rest_api_v3_push/
 * PHP API文档:https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#push-api--构建推送pushpayload
 */
require_once("../src/JPush/JPush.php");
class messagePush {
	private $br = '<br/>';
	private $app_key = 'ffcb4753c7f273394deb1620';
	private $master_secret = '0e38d95ad39fb2aa79cccf9d';
	
	//返回数据
	function backMessage($content,$title,$id){
		$client = new JPush($this->app_key, $this->master_secret);
		$result =$client->push()
				->setPlatform(array('ios', 'android'))
				->addAllAudience()
				->setNotificationAlert('Hi, JPush')
				->addAndroidNotification("$title", 'notification title', 1, array("key1"=>"value1", "key2"=>"value2"))
				->addIosNotification("$title", 'iOS sound', '+1', true, 'iOS category', array("key1"=>"value1", "key2"=>"value2"))
				->setMessage("$content", "$title", 'type', array("key1"=>"$id"))
				->setOptions(100000, 3600, null, false)
				->send();

           return 'Result=' . json_encode($result) . $br;
	}

  
}
/*
$message=array('msg_content'=>'hahha');
$mess=new messagePush();
$mess->backMessage($message,'1234哈哈','1234');
*/